<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<script type="text/javascript">
	function doDisplayCategory()
	{
			
			if(document.getElementById("newCate").style.display=="block")
			{
				document.getElementById("newCate").style.display="none" ;
			}
			else
			{
				document.getElementById("newCate").style.display="block";
			}	

			if(document.getElementById("data1").style.display=="block")
			{
				document.getElementById("data1").style.display="none" ;
			}
			else
			{
				document.getElementById("data1").style.display="block";
			}	
	}
	function doDisplayCategory2()
	{
	if(document.getElementById("newCate2")!= null)
	{	
		if(document.getElementById("newCate2").style.display=="block")
		{
			document.getElementById("newCate2").style.display="none" ;
		}
		else
		{
			document.getElementById("newCate2").style.display="block";
		}
	}
		if(document.getElementById("data2").style.display=="block")
		{
			document.getElementById("data2").style.display="none" ;
		}
		else
		{
			document.getElementById("data2").style.display="block";
		}	
	}
</script>


<table>
	<tr><td>Locations in ${category.name}</td><td><a href="#" onclick="doDisplayCategory() ; doDisplayCategory2();"><div id="data1" style="display:block">create new location in ${category.name}</div><div id="data2" style="display:none">Back</div></a></td></tr>
</table>

Category Path :- <s:iterator value="path">
						/<a href="category?p=1&uuid=${key}">${value}</a>
				</s:iterator>
<br/>
<s:if test="%{confirmDelete == 1}">
<div style="border: 1px solid red;color: red;font-weight: bold;width: 589px;">
	<table>
	<tr>
	<td>
		Deleting the category will delete its all sub category and its assignment.<br/>
		Do you want to continue ?
	</td>
	<td>
	</td>
	</tr>
	<tr>
		<td>
			<s:form action="deleteCategory" name="deleteCategory" method="post">
				<input type="hidden" name="uuid" value="${category.uuid}"/>
				<input type="hidden" name="cateToDeleteId" value="${cateToDeleteId}"/>
				<input type="hidden" name="p" value="${p}"/>
				<s:submit name="deletecategory" value="Delete"/>
				<s:submit name="cancelDeletecategory" value="Cancel" action="cancelDeletecategory"/>
			</s:form>
		</td>
		<td>
		</td>
	</tr>
	</table>
</div>
</s:if>

Category Type :- ${category.categoryType.type}
<s:if test="categories.size() > 0">
<div style="display:block" id="newCate2">
<table cellpadding="5px">
		<tr>
			<th>Id</th>
			<th>Name</th>
			<th>Type</th>
			<th>Edit</th>
			<th>Delete</th>
		</tr>
	<s:iterator value="categories" var="cate">
		<tr>
			<td><s:property value="uuid" /></td>
			<td><a href='category?p=1&uuid=<s:property value="uuid" />'><s:property value="name" /></a></td>
			<td><s:property value="categoryType.type" /></td>
			<td><a href='editCategory?p=1&uuid=<s:property value="uuid" />'>Edit</a></td>
			<td><form name="confirmDeleteCatagory" action="confirmDeleteCatagory" method="post"/>
					<input type="hidden" name="uuid" value="${category.uuid}"/>
					<input type="hidden" name="cateToDeleteId" value="${cate.uuid}"/>
					<input type="hidden" name="p" value="${p}"/>
					<input type="submit" name="deletecategory" value="Delete"/>
				</form>
			</td>
		</tr>
	</s:iterator>
</table>
</div>
</s:if>



<div style="display:none" id="newCate">
<form name="createCategory" action="createCategory" method="post" id="createCategory">
	<table>
		<tr>
			<td>Location Name</td><td><input type="text" name="name">
 				<input type="hidden" name="uuid" value="${category.uuid}"/>
				<input type="hidden" name="p" value="${p}"/>
			</td>
		</tr>
		<tr>
				<td>Category Type</td>
				<td>
				<select name="cateType">
					<s:iterator value="categoryTypes" >
						<option value='<s:property value="uuid" />'><s:property value="type" /></option>
						
					</s:iterator>
				</select>
				</td>
		</tr>
		<tr>
			<td></td><td><input type="submit"  name="create" value="Create"></td>
		</tr>
	</table>
</form>
</div>
<br/>
<hr/>
<table width="100%"  style="font-size: 23px;padding: 0;text-align: center;">
	<tr><td style="text-align:center">Properties in Location</td></tr>
</table>

<table cellpadding="5px">
		<tr>
			<th>Id</th>
			<th>Name</th>
			<th>sku</th>
			<th>Enabled</th>
		</tr>
<s:if test="products.size() > 0">
		<s:iterator value="products">
		<tr>
			<td><s:property value="uuid" /></td>
			<td><s:property value="name" /></td>
			<td><s:property value="sku" /></td>
			<td><s:property value="enabled" /></td>
		</tr>
		</s:iterator>
</s:if>
</table>
